import React from 'react'
import Loadable from "react-loadable"
//登陆页面
import Login from '../layout/login/login';
//404
import NoMatch404 from '../components/error/404';
import NoMatch403 from '../components/error/403';
import NoMatch500 from '../components/error/500';

//布局box
import Layout from '../layout/layout';
import Show from '../layout/content/index/Show';

//营销中心
import OrderList from '../layout/content/marketing/order-list';

//设置-用户管理
import UserList from '../layout/content/user/user-list';
import UserRole from '../layout/content/user/user-role';
import UserPerm from '../layout/content/user/user-perm';

//辅助功能
import Upload from '../layout/content/tool/upload'



/**
 ** 示例
 **/
import Context from '../layout/content/example/context';
import Todo from '../layout/content/example/todo';

//示例 - async
const Dispatch1 = () => import('../layout/content/example/dispatch1');
const Dispatch2 = () => import('../layout/content/example/dispatch2');

const defaultLoad = () => <div/>;

const config = [
    {
        path: '/',
        exact: true,
        component: Layout
    },
    {
        path: '/login',
        component: Login
    },
    {
        path: '/app',
        component: Layout,
        routes: [
            {
                path: '/app/index',
                name:'分析统计',
                icon:'home',
                //component: Context,
                children:[
                    {
                        path:'/app/index/home',
                        name:'统计图表',
                        component: Context,
                    }
                ]
            },
            //订单
            {
                path:'/app/marketing',
                name:'营销中心',
                icon:'shop',
                children:[
                    {
                        path: '/app/marketing/orderList',
                        name:'订单列表',
                        component:OrderList
                    }
                ]
            },
            //工具
            {
                path:'/app/tool',
                name:'辅助功能',
                icon:'inbox',
                children:[
                    {
                        path: '/app/tool/upLoad',
                        name:'上传图片',
                        component: Upload
                    },
                    {
                        path: '/app/tool/option2',
                        name:'option2',
                        component: Loadable({
                            loader: Dispatch2,
                            loading: defaultLoad
                        })
                    },
                ]
            },
            //设置
            {
                path:'/app/option',
                name:'设置',
                icon:'setting',
                children:[
                    {
                        path:'/app/option/user/userList',
                        name:'用户列表',
                        component:UserList
                    },
                    {
                        path:'/app/option/user/userRole',
                        name:'角色管理',
                        component:UserRole
                    },
                    {
                        path:'/app/option/user/userPerm',
                        name:'权限管理',
                        component:UserPerm
                    }
                ]
            },
            //error
            {
                path: '/app/404',
                component: NoMatch404,
                hideInMenu:true
            },
            {
                path: '/app/403',
                component: NoMatch403,
                hideInMenu:true
            },
            {
                path: '/app/500',
                component: NoMatch500,
                hideInMenu:true
            },
        ]
    }
];
export default config